{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "04ce952e",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "34ea2970",
   "metadata": {},
   "outputs": [],
   "source": [
    "singletons = pd.read_csv(\"../data/singletons.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "441fa2b8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Unnamed: 0</th>\n",
       "      <th>characterID</th>\n",
       "      <th>characterLabel</th>\n",
       "      <th>characterURL</th>\n",
       "      <th>n_wiki</th>\n",
       "      <th>wikis</th>\n",
       "      <th>top20rank;;;;;;;;</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>879</td>\n",
       "      <td>Q7307079</td>\n",
       "      <td>Refaat Ismael</td>\n",
       "      <td>http://www.wikidata.org/entity/Q7307079</td>\n",
       "      <td>1.0</td>\n",
       "      <td>ar</td>\n",
       "      <td>-1;;;;;;;Arabic;</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1045</td>\n",
       "      <td>Q6746584</td>\n",
       "      <td>Manabu Yukawa</td>\n",
       "      <td>http://www.wikidata.org/entity/Q6746584</td>\n",
       "      <td>1.0</td>\n",
       "      <td>ar</td>\n",
       "      <td>-1;;;;;;;;</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>5477</td>\n",
       "      <td>Q12215141</td>\n",
       "      <td>Q12215141</td>\n",
       "      <td>http://www.wikidata.org/entity/Q12215141</td>\n",
       "      <td>1.0</td>\n",
       "      <td>ar</td>\n",
       "      <td>-1;;;;;;;;</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>5475</td>\n",
       "      <td>Q12227809</td>\n",
       "      <td>Q12227809</td>\n",
       "      <td>http://www.wikidata.org/entity/Q12227809</td>\n",
       "      <td>1.0</td>\n",
       "      <td>ar</td>\n",
       "      <td>-1;;;;;;;;</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5474</td>\n",
       "      <td>Q12230453</td>\n",
       "      <td>Q12230453</td>\n",
       "      <td>http://www.wikidata.org/entity/Q12230453</td>\n",
       "      <td>1.0</td>\n",
       "      <td>ar</td>\n",
       "      <td>-1;;;;;;;;</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2230</th>\n",
       "      <td>4489</td>\n",
       "      <td>Q21045722</td>\n",
       "      <td>Jia Daishan</td>\n",
       "      <td>http://www.wikidata.org/entity/Q21045722</td>\n",
       "      <td>1.0</td>\n",
       "      <td>zh</td>\n",
       "      <td>15;;;;;;;;</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2231</th>\n",
       "      <td>4500</td>\n",
       "      <td>Q21000364</td>\n",
       "      <td>Wen Zhongrong</td>\n",
       "      <td>http://www.wikidata.org/entity/Q21000364</td>\n",
       "      <td>1.0</td>\n",
       "      <td>zh</td>\n",
       "      <td>15;;;;;;;;</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2232</th>\n",
       "      <td>6352</td>\n",
       "      <td>Q10540116</td>\n",
       "      <td>Concubine Zhao</td>\n",
       "      <td>http://www.wikidata.org/entity/Q10540116</td>\n",
       "      <td>1.0</td>\n",
       "      <td>zh</td>\n",
       "      <td>15;;;;;;;;</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2233</th>\n",
       "      <td>6316</td>\n",
       "      <td>Q10565032</td>\n",
       "      <td>Q10565032</td>\n",
       "      <td>http://www.wikidata.org/entity/Q10565032</td>\n",
       "      <td>1.0</td>\n",
       "      <td>zh</td>\n",
       "      <td>15;;;;;;;;</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2234</th>\n",
       "      <td>4884</td>\n",
       "      <td>Q17039726</td>\n",
       "      <td>Jia Yuan</td>\n",
       "      <td>http://www.wikidata.org/entity/Q17039726</td>\n",
       "      <td>1.0</td>\n",
       "      <td>zh</td>\n",
       "      <td>15;;;;;;;;</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2235 rows × 7 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     Unnamed: 0 characterID  characterLabel  \\\n",
       "0           879    Q7307079   Refaat Ismael   \n",
       "1          1045    Q6746584   Manabu Yukawa   \n",
       "2          5477   Q12215141       Q12215141   \n",
       "3          5475   Q12227809       Q12227809   \n",
       "4          5474   Q12230453       Q12230453   \n",
       "...         ...         ...             ...   \n",
       "2230       4489   Q21045722     Jia Daishan   \n",
       "2231       4500   Q21000364   Wen Zhongrong   \n",
       "2232       6352   Q10540116  Concubine Zhao   \n",
       "2233       6316   Q10565032       Q10565032   \n",
       "2234       4884   Q17039726        Jia Yuan   \n",
       "\n",
       "                                  characterURL  n_wiki wikis top20rank;;;;;;;;  \n",
       "0      http://www.wikidata.org/entity/Q7307079     1.0    ar  -1;;;;;;;Arabic;  \n",
       "1      http://www.wikidata.org/entity/Q6746584     1.0    ar        -1;;;;;;;;  \n",
       "2     http://www.wikidata.org/entity/Q12215141     1.0    ar        -1;;;;;;;;  \n",
       "3     http://www.wikidata.org/entity/Q12227809     1.0    ar        -1;;;;;;;;  \n",
       "4     http://www.wikidata.org/entity/Q12230453     1.0    ar        -1;;;;;;;;  \n",
       "...                                        ...     ...   ...               ...  \n",
       "2230  http://www.wikidata.org/entity/Q21045722     1.0    zh        15;;;;;;;;  \n",
       "2231  http://www.wikidata.org/entity/Q21000364     1.0    zh        15;;;;;;;;  \n",
       "2232  http://www.wikidata.org/entity/Q10540116     1.0    zh        15;;;;;;;;  \n",
       "2233  http://www.wikidata.org/entity/Q10565032     1.0    zh        15;;;;;;;;  \n",
       "2234  http://www.wikidata.org/entity/Q17039726     1.0    zh        15;;;;;;;;  \n",
       "\n",
       "[2235 rows x 7 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "singletons"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "0a502628",
   "metadata": {},
   "outputs": [],
   "source": [
    "works = pd.read_csv(\"../data/raw/wikidata/works-country-P1441.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "ad625b83",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>character</th>\n",
       "      <th>characterLabel</th>\n",
       "      <th>work</th>\n",
       "      <th>workLabel</th>\n",
       "      <th>countryLabel</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>http://www.wikidata.org/entity/Q6668</td>\n",
       "      <td>Pippi Longstocking</td>\n",
       "      <td>http://www.wikidata.org/entity/Q2446285</td>\n",
       "      <td>Pippi Longstocking</td>\n",
       "      <td>Sweden</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>http://www.wikidata.org/entity/Q6668</td>\n",
       "      <td>Pippi Longstocking</td>\n",
       "      <td>http://www.wikidata.org/entity/Q2971575</td>\n",
       "      <td>Pippi Longstocking</td>\n",
       "      <td>Sweden</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>http://www.wikidata.org/entity/Q6668</td>\n",
       "      <td>Pippi Longstocking</td>\n",
       "      <td>http://www.wikidata.org/entity/Q2971575</td>\n",
       "      <td>Pippi Longstocking</td>\n",
       "      <td>Germany</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>http://www.wikidata.org/entity/Q60702</td>\n",
       "      <td>Eragon</td>\n",
       "      <td>http://www.wikidata.org/entity/Q60672</td>\n",
       "      <td>Inheritance</td>\n",
       "      <td>United States of America</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>http://www.wikidata.org/entity/Q60702</td>\n",
       "      <td>Eragon</td>\n",
       "      <td>http://www.wikidata.org/entity/Q185449</td>\n",
       "      <td>Eragon</td>\n",
       "      <td>United States of America</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13966</th>\n",
       "      <td>http://www.wikidata.org/entity/Q1000118</td>\n",
       "      <td>Peter Pettigrew</td>\n",
       "      <td>http://www.wikidata.org/entity/Q46751</td>\n",
       "      <td>Harry Potter and the Goblet of Fire</td>\n",
       "      <td>United Kingdom</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13967</th>\n",
       "      <td>http://www.wikidata.org/entity/Q1000118</td>\n",
       "      <td>Peter Pettigrew</td>\n",
       "      <td>http://www.wikidata.org/entity/Q47598</td>\n",
       "      <td>Harry Potter and the Prisoner of Azkaban</td>\n",
       "      <td>United Kingdom</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13968</th>\n",
       "      <td>http://www.wikidata.org/entity/Q1000118</td>\n",
       "      <td>Peter Pettigrew</td>\n",
       "      <td>http://www.wikidata.org/entity/Q102225</td>\n",
       "      <td>Harry Potter and the Goblet of Fire</td>\n",
       "      <td>United States of America</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13969</th>\n",
       "      <td>http://www.wikidata.org/entity/Q1000118</td>\n",
       "      <td>Peter Pettigrew</td>\n",
       "      <td>http://www.wikidata.org/entity/Q102225</td>\n",
       "      <td>Harry Potter and the Goblet of Fire</td>\n",
       "      <td>United Kingdom</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13970</th>\n",
       "      <td>http://www.wikidata.org/entity/Q1000118</td>\n",
       "      <td>Peter Pettigrew</td>\n",
       "      <td>http://www.wikidata.org/entity/Q28146833</td>\n",
       "      <td>Severus Snape and the Marauders</td>\n",
       "      <td>United States of America</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>13971 rows × 5 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                     character      characterLabel  \\\n",
       "0         http://www.wikidata.org/entity/Q6668  Pippi Longstocking   \n",
       "1         http://www.wikidata.org/entity/Q6668  Pippi Longstocking   \n",
       "2         http://www.wikidata.org/entity/Q6668  Pippi Longstocking   \n",
       "3        http://www.wikidata.org/entity/Q60702              Eragon   \n",
       "4        http://www.wikidata.org/entity/Q60702              Eragon   \n",
       "...                                        ...                 ...   \n",
       "13966  http://www.wikidata.org/entity/Q1000118     Peter Pettigrew   \n",
       "13967  http://www.wikidata.org/entity/Q1000118     Peter Pettigrew   \n",
       "13968  http://www.wikidata.org/entity/Q1000118     Peter Pettigrew   \n",
       "13969  http://www.wikidata.org/entity/Q1000118     Peter Pettigrew   \n",
       "13970  http://www.wikidata.org/entity/Q1000118     Peter Pettigrew   \n",
       "\n",
       "                                           work  \\\n",
       "0       http://www.wikidata.org/entity/Q2446285   \n",
       "1       http://www.wikidata.org/entity/Q2971575   \n",
       "2       http://www.wikidata.org/entity/Q2971575   \n",
       "3         http://www.wikidata.org/entity/Q60672   \n",
       "4        http://www.wikidata.org/entity/Q185449   \n",
       "...                                         ...   \n",
       "13966     http://www.wikidata.org/entity/Q46751   \n",
       "13967     http://www.wikidata.org/entity/Q47598   \n",
       "13968    http://www.wikidata.org/entity/Q102225   \n",
       "13969    http://www.wikidata.org/entity/Q102225   \n",
       "13970  http://www.wikidata.org/entity/Q28146833   \n",
       "\n",
       "                                      workLabel              countryLabel  \n",
       "0                            Pippi Longstocking                    Sweden  \n",
       "1                            Pippi Longstocking                    Sweden  \n",
       "2                            Pippi Longstocking                   Germany  \n",
       "3                                   Inheritance  United States of America  \n",
       "4                                        Eragon  United States of America  \n",
       "...                                         ...                       ...  \n",
       "13966       Harry Potter and the Goblet of Fire            United Kingdom  \n",
       "13967  Harry Potter and the Prisoner of Azkaban            United Kingdom  \n",
       "13968       Harry Potter and the Goblet of Fire  United States of America  \n",
       "13969       Harry Potter and the Goblet of Fire            United Kingdom  \n",
       "13970           Severus Snape and the Marauders  United States of America  \n",
       "\n",
       "[13971 rows x 5 columns]"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "works"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "57ad4218",
   "metadata": {},
   "outputs": [],
   "source": [
    "joint = pd.merge(singletons,works,on = \"characterLabel\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "3d962c8a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Unnamed: 0</th>\n",
       "      <th>characterID</th>\n",
       "      <th>characterLabel</th>\n",
       "      <th>characterURL</th>\n",
       "      <th>n_wiki</th>\n",
       "      <th>wikis</th>\n",
       "      <th>top20rank;;;;;;;;</th>\n",
       "      <th>character</th>\n",
       "      <th>work</th>\n",
       "      <th>workLabel</th>\n",
       "      <th>countryLabel</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>879</td>\n",
       "      <td>Q7307079</td>\n",
       "      <td>Refaat Ismael</td>\n",
       "      <td>http://www.wikidata.org/entity/Q7307079</td>\n",
       "      <td>1.0</td>\n",
       "      <td>ar</td>\n",
       "      <td>-1;;;;;;;Arabic;</td>\n",
       "      <td>http://www.wikidata.org/entity/Q7307079</td>\n",
       "      <td>http://www.wikidata.org/entity/Q6720836</td>\n",
       "      <td>Ma Waraa Al Tabiaa</td>\n",
       "      <td>Egypt</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1045</td>\n",
       "      <td>Q6746584</td>\n",
       "      <td>Manabu Yukawa</td>\n",
       "      <td>http://www.wikidata.org/entity/Q6746584</td>\n",
       "      <td>1.0</td>\n",
       "      <td>ar</td>\n",
       "      <td>-1;;;;;;;;</td>\n",
       "      <td>http://www.wikidata.org/entity/Q6746584</td>\n",
       "      <td>http://www.wikidata.org/entity/Q847426</td>\n",
       "      <td>The Devotion of Suspect X</td>\n",
       "      <td>Japan</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>5477</td>\n",
       "      <td>Q12215141</td>\n",
       "      <td>Q12215141</td>\n",
       "      <td>http://www.wikidata.org/entity/Q12215141</td>\n",
       "      <td>1.0</td>\n",
       "      <td>ar</td>\n",
       "      <td>-1;;;;;;;;</td>\n",
       "      <td>http://www.wikidata.org/entity/Q12215141</td>\n",
       "      <td>http://www.wikidata.org/entity/Q6720836</td>\n",
       "      <td>Ma Waraa Al Tabiaa</td>\n",
       "      <td>Egypt</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>5475</td>\n",
       "      <td>Q12227809</td>\n",
       "      <td>Q12227809</td>\n",
       "      <td>http://www.wikidata.org/entity/Q12227809</td>\n",
       "      <td>1.0</td>\n",
       "      <td>ar</td>\n",
       "      <td>-1;;;;;;;;</td>\n",
       "      <td>http://www.wikidata.org/entity/Q12227809</td>\n",
       "      <td>http://www.wikidata.org/entity/Q8258</td>\n",
       "      <td>One Thousand and One Nights</td>\n",
       "      <td>Near East</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5475</td>\n",
       "      <td>Q12227809</td>\n",
       "      <td>Q12227809</td>\n",
       "      <td>http://www.wikidata.org/entity/Q12227809</td>\n",
       "      <td>1.0</td>\n",
       "      <td>ar</td>\n",
       "      <td>-1;;;;;;;;</td>\n",
       "      <td>http://www.wikidata.org/entity/Q12227809</td>\n",
       "      <td>http://www.wikidata.org/entity/Q16122380</td>\n",
       "      <td>Q16122380</td>\n",
       "      <td>Syria</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2505</th>\n",
       "      <td>6341</td>\n",
       "      <td>Q10554902</td>\n",
       "      <td>Xing Dequan</td>\n",
       "      <td>http://www.wikidata.org/entity/Q10554902</td>\n",
       "      <td>1.0</td>\n",
       "      <td>zh</td>\n",
       "      <td>15;;;;;;;;</td>\n",
       "      <td>http://www.wikidata.org/entity/Q10554902</td>\n",
       "      <td>http://www.wikidata.org/entity/Q8265</td>\n",
       "      <td>Dream of the Red Chamber</td>\n",
       "      <td>Qing dynasty</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2506</th>\n",
       "      <td>4489</td>\n",
       "      <td>Q21045722</td>\n",
       "      <td>Jia Daishan</td>\n",
       "      <td>http://www.wikidata.org/entity/Q21045722</td>\n",
       "      <td>1.0</td>\n",
       "      <td>zh</td>\n",
       "      <td>15;;;;;;;;</td>\n",
       "      <td>http://www.wikidata.org/entity/Q21045722</td>\n",
       "      <td>http://www.wikidata.org/entity/Q8265</td>\n",
       "      <td>Dream of the Red Chamber</td>\n",
       "      <td>Qing dynasty</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2507</th>\n",
       "      <td>4500</td>\n",
       "      <td>Q21000364</td>\n",
       "      <td>Wen Zhongrong</td>\n",
       "      <td>http://www.wikidata.org/entity/Q21000364</td>\n",
       "      <td>1.0</td>\n",
       "      <td>zh</td>\n",
       "      <td>15;;;;;;;;</td>\n",
       "      <td>http://www.wikidata.org/entity/Q21000364</td>\n",
       "      <td>http://www.wikidata.org/entity/Q70827</td>\n",
       "      <td>Water Margin</td>\n",
       "      <td>Yuan Empire</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2508</th>\n",
       "      <td>6352</td>\n",
       "      <td>Q10540116</td>\n",
       "      <td>Concubine Zhao</td>\n",
       "      <td>http://www.wikidata.org/entity/Q10540116</td>\n",
       "      <td>1.0</td>\n",
       "      <td>zh</td>\n",
       "      <td>15;;;;;;;;</td>\n",
       "      <td>http://www.wikidata.org/entity/Q10540116</td>\n",
       "      <td>http://www.wikidata.org/entity/Q8265</td>\n",
       "      <td>Dream of the Red Chamber</td>\n",
       "      <td>Qing dynasty</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2509</th>\n",
       "      <td>4884</td>\n",
       "      <td>Q17039726</td>\n",
       "      <td>Jia Yuan</td>\n",
       "      <td>http://www.wikidata.org/entity/Q17039726</td>\n",
       "      <td>1.0</td>\n",
       "      <td>zh</td>\n",
       "      <td>15;;;;;;;;</td>\n",
       "      <td>http://www.wikidata.org/entity/Q17039726</td>\n",
       "      <td>http://www.wikidata.org/entity/Q8265</td>\n",
       "      <td>Dream of the Red Chamber</td>\n",
       "      <td>Qing dynasty</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2510 rows × 11 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     Unnamed: 0 characterID  characterLabel  \\\n",
       "0           879    Q7307079   Refaat Ismael   \n",
       "1          1045    Q6746584   Manabu Yukawa   \n",
       "2          5477   Q12215141       Q12215141   \n",
       "3          5475   Q12227809       Q12227809   \n",
       "4          5475   Q12227809       Q12227809   \n",
       "...         ...         ...             ...   \n",
       "2505       6341   Q10554902     Xing Dequan   \n",
       "2506       4489   Q21045722     Jia Daishan   \n",
       "2507       4500   Q21000364   Wen Zhongrong   \n",
       "2508       6352   Q10540116  Concubine Zhao   \n",
       "2509       4884   Q17039726        Jia Yuan   \n",
       "\n",
       "                                  characterURL  n_wiki wikis  \\\n",
       "0      http://www.wikidata.org/entity/Q7307079     1.0    ar   \n",
       "1      http://www.wikidata.org/entity/Q6746584     1.0    ar   \n",
       "2     http://www.wikidata.org/entity/Q12215141     1.0    ar   \n",
       "3     http://www.wikidata.org/entity/Q12227809     1.0    ar   \n",
       "4     http://www.wikidata.org/entity/Q12227809     1.0    ar   \n",
       "...                                        ...     ...   ...   \n",
       "2505  http://www.wikidata.org/entity/Q10554902     1.0    zh   \n",
       "2506  http://www.wikidata.org/entity/Q21045722     1.0    zh   \n",
       "2507  http://www.wikidata.org/entity/Q21000364     1.0    zh   \n",
       "2508  http://www.wikidata.org/entity/Q10540116     1.0    zh   \n",
       "2509  http://www.wikidata.org/entity/Q17039726     1.0    zh   \n",
       "\n",
       "     top20rank;;;;;;;;                                 character  \\\n",
       "0     -1;;;;;;;Arabic;   http://www.wikidata.org/entity/Q7307079   \n",
       "1           -1;;;;;;;;   http://www.wikidata.org/entity/Q6746584   \n",
       "2           -1;;;;;;;;  http://www.wikidata.org/entity/Q12215141   \n",
       "3           -1;;;;;;;;  http://www.wikidata.org/entity/Q12227809   \n",
       "4           -1;;;;;;;;  http://www.wikidata.org/entity/Q12227809   \n",
       "...                ...                                       ...   \n",
       "2505        15;;;;;;;;  http://www.wikidata.org/entity/Q10554902   \n",
       "2506        15;;;;;;;;  http://www.wikidata.org/entity/Q21045722   \n",
       "2507        15;;;;;;;;  http://www.wikidata.org/entity/Q21000364   \n",
       "2508        15;;;;;;;;  http://www.wikidata.org/entity/Q10540116   \n",
       "2509        15;;;;;;;;  http://www.wikidata.org/entity/Q17039726   \n",
       "\n",
       "                                          work                    workLabel  \\\n",
       "0      http://www.wikidata.org/entity/Q6720836           Ma Waraa Al Tabiaa   \n",
       "1       http://www.wikidata.org/entity/Q847426    The Devotion of Suspect X   \n",
       "2      http://www.wikidata.org/entity/Q6720836           Ma Waraa Al Tabiaa   \n",
       "3         http://www.wikidata.org/entity/Q8258  One Thousand and One Nights   \n",
       "4     http://www.wikidata.org/entity/Q16122380                    Q16122380   \n",
       "...                                        ...                          ...   \n",
       "2505      http://www.wikidata.org/entity/Q8265     Dream of the Red Chamber   \n",
       "2506      http://www.wikidata.org/entity/Q8265     Dream of the Red Chamber   \n",
       "2507     http://www.wikidata.org/entity/Q70827                 Water Margin   \n",
       "2508      http://www.wikidata.org/entity/Q8265     Dream of the Red Chamber   \n",
       "2509      http://www.wikidata.org/entity/Q8265     Dream of the Red Chamber   \n",
       "\n",
       "      countryLabel  \n",
       "0            Egypt  \n",
       "1            Japan  \n",
       "2            Egypt  \n",
       "3        Near East  \n",
       "4            Syria  \n",
       "...            ...  \n",
       "2505  Qing dynasty  \n",
       "2506  Qing dynasty  \n",
       "2507   Yuan Empire  \n",
       "2508  Qing dynasty  \n",
       "2509  Qing dynasty  \n",
       "\n",
       "[2510 rows x 11 columns]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "joint"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "f5964aec",
   "metadata": {},
   "outputs": [],
   "source": [
    "joint.to_csv(\"joint.csv\", sep='\\t', encoding='utf-8')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "36e5c586",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
